package com.i360day.redis.listener.keyexpire;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

/**
 * @program: sx_cz_zhyw
 * @description: redis key值过期执行器
 * @author: liju.z
 * @create: 2020-10-13 10:32
 **/
public class RedisKeyExpireActuator {

    private Collection<RedisKeyExpireListenerAdapter> redisKeyExpireListenerAdapterList = Collections.synchronizedList(new ArrayList<>());

    public RedisKeyExpireActuator(Collection<RedisKeyExpireListenerAdapter> redisKeyExpireListenerAdapterList) {
        this.redisKeyExpireListenerAdapterList.addAll(redisKeyExpireListenerAdapterList);
    }

    public Collection<RedisKeyExpireListenerAdapter> getRedisKeyExpireListenerAdapterList() {
        return redisKeyExpireListenerAdapterList;
    }

    public void invoke(RedisKeyExpireListenerAdapter redisKeyExpireListenerAdapter, Object value) {
        redisKeyExpireListenerAdapter.keyExpireHandle(value.toString());
    }
}
